package com.lzx.user.controller.web;

import com.lzx.common.utils.R;
import com.lzx.user.entity.Inform;
import com.lzx.user.entity.vo.NicknameVO;
import com.lzx.user.entity.vo.OssVO;
import com.lzx.user.service.InformService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author 程序员星星
 * @date 2022/12/28
 * @Description
 */
@RestController
@RequestMapping("/user/inform/web")
public class WebInformController {
    @Resource
    private InformService informService;

    //修改用户昵称(通知)
    @PutMapping("/updateNicknameToInform")
    public String updateNicknameToInform(@RequestBody NicknameVO nicknameVO) {
        return informService.updateNicknameToInform(nicknameVO);
    }

    //修改用户头像(通知)
    @PutMapping("/updateAvatarToInform")
    public String updateAvatarToInform(@RequestBody OssVO ossVO) {
        return informService.updateAvatarToInform(ossVO);
    }

    //获取系统通知
    @GetMapping("/getSystemInform/{type}/{current}/{size}")
    public R getSystemInform(@PathVariable int type, @PathVariable int current, @PathVariable int size) {
        return informService.getSystemInform(type, current, size);
    }

    //修改是否已读
    @PutMapping("/updateIsRead/{userId}/{id}")
    public R updateIsRead(@PathVariable Long userId, @PathVariable Long id) {
        return informService.updateIsRead(userId, id);
    }

    //获取通知
    @GetMapping("/getInformList/{userId}/{type}/{current}/{size}")
    public R getInformList(@PathVariable Long userId, @PathVariable int[] type, @PathVariable int current, @PathVariable int size) {
        return informService.getInformList(userId, type, current, size);
    }

    //保存通知
    @PostMapping("/saveInform")
    public String saveInform(@RequestBody Inform inform) {
        return informService.saveInform(inform);
    }
}
